package com.todod.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.todod.entity.QueryEntry;
import com.todod.entity.ResultData;
import com.todod.model.Authority;
import com.todod.service.IAuthorityService;

/**
 * 新增用户
 * 
 * @author MengHaoPeng
 **/
@RestController
@RequestMapping("/authority")
public class AuthorityController extends BaseManageController {

	@Autowired
	private IAuthorityService authorityService;

	/**
	 * @Title: getList
	 * @Description:获取权限列表
	 * @author MengHaoPeng
	 * @date 2019-10-09
	 * @return String
	 */
	@RequestMapping("/getList")
	public ResultData getList(@RequestBody QueryEntry queryEntry) {

		List<Authority> list = authorityService.getList(queryEntry);

		return ResultData.success("ok", list);
	}

	/**
	 * @Title: editData
	 * @Description:编辑权限
	 * @author MengHaoPeng
	 * @date 2019-10-11
	 * 
	 */
	@RequestMapping("/editData")
	public ResultData editData(@RequestAttribute Long _userId, @RequestBody Authority authority) {
		authorityService.editData(_userId, authority);
		return ResultData.success();
	}

}
